//- Copyright (c) 2016 Lucky Byte, Inc.

.fields.trctl
  h4.ui.horizontal.divider.header 交易权限
    .ui.buttons
      button.ui.button.basic#trcode_all(type="button")
        i.icon.checkmark
        | 全勾选
      button.ui.button.basic#trcode_none(type="button")
        i.icon.remove
        | 全不选

-
  trctl_codes = [
    [
      { code: 't1',  checked: true },
      { code: 't2',  checked: true },
      { code: 't3',  checked: true },
      { code: 't4',  checked: true },
      { code: 't5',  checked: true },
      { code: 't22', checked: false },
      { code: 't10', checked: true },
      { code: 't11', checked: true },
    ], [
      { code: 't20', checked: true },
      { code: 't21', checked: false },
      { code: 't23', checked: true },
      { code: 't24', checked: false },
      { code: 't60',  checked: false },
      { code: 't40', checked: false },
      { code: 't41', checked: false },
    ], [
      { code: 't50', checked: false },
      { code: 't51', checked: false },
      { code: 't52', checked: false },
      { code: 't30', checked: false },
      { code: 't31', checked: false },
      { code: 't32', checked: fales },
      { code: 't33', checked: fales },
    ], [
      { code: 'tz0', checked: false, inner: true },
      { code: 'tz1', checked: false, inner: true },
    ]
  ]
each line in trctl_codes
  .fields.trctl(style="padding-left:20px;")
    each item in line
      .field.two.wide
        .ui.checkbox.input.trcode(class="#{item.code}")
          if item.checked
            input(type="checkbox" name="#{item.code}" checked="checked")
          else
            input(type="checkbox" name="#{item.code}")
          if item.inner
            label(style="color:#f2f;")= constant.trctl_codes[item.code]
          else
            label= constant.trctl_codes[item.code]

-
  var limits = {
    't20' : '消费交易限制',
    't60' : '助农取款限制',
    'tz0' : '商户代付限制'
  }

each name, code in limits
  .fields.trctl(class="#{code}")
    h4.ui.horizontal.divider.header= name

  .fields.trctl(class="#{code}")
    .field.two.wide
      label 交易起始时间:
        i.icon.help.blue(
          data-content="留空表示不限制，后同" data-variation="small")
      .ui.calendar.time
        .ui.input.left.icon
          i.wait.icon
          input(type="text" name="time_begin")
    .field.two.wide
      label 交易结束时间:
      .ui.calendar.time
        .ui.input.left.icon
          i.wait.icon
          input(type="text" name="time_end")

    .field.three.wide
      label.ui 单笔交易最小金额:
        i.icon.help.blue(
          data-content="0 表示不限制，后同" data-variation="small wide")
      .ui.right.labeled.input
        .ui.label.basic 借
        input(type="text" name="min_amt_per" value="0.0")
        .ui.label.basic 元
      .ui.right.labeled.input
        .ui.label.basic 贷
        input(type="text" name="min_amt_per2" value="0.0")
        .ui.label.basic 元

    .field.three.wide
      label.ui 单笔交易最大金额:
      .ui.right.labeled.input
        .ui.label.basic 借
        input(type="text" name="max_amt_per" value="0.0")
        .ui.label.basic 元
      .ui.right.labeled.input
        .ui.label.basic 贷
        input(type="text" name="max_amt_per2" value="0.0")
        .ui.label.basic 元

    .field.three.wide
      label.ui 分钟最大交易金额/笔数:
      .ui.right.labeled.input
        .ui.label.basic
          i.icon.yen(style="margin-right:0px;")
        input(type="text" name="max_amt_minute" value="0.0")
        .ui.label.basic 元
      .ui.right.labeled.input
        .ui.label.basic
          i.icon.italic(style="margin-right:0px;")
        input(type="text" name="max_cnt_minute" value="0")
        .ui.label.basic 笔

    .field.three.wide
      label.ui 每日最大交易金额/笔数:
      .ui.right.labeled.input
        .ui.label.basic
          i.icon.yen(style="margin-right:0px;")
        input(type="text" name="max_amt_day" value="0.0")
        .ui.label.basic 元
      .ui.right.labeled.input
        .ui.label.basic
          i.icon.italic(style="margin-right:0px;")
        input(type="text" name="max_cnt_day" value="0")
        .ui.label.basic 笔
